{include file="common/_meta"}

<title>基本设置</title>
</head>
<body>
{include file="common/_header"}
{include file="common/_menu"}

<section class="Hui-article-box">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span
            class="c-gray en">&gt;</span> 清理数据 <a class="btn btn-success radius r"
                                                  style="line-height:1.6em;margin-top:3px"
                                                  href="javascript:location.replace(location.href);" title="刷新"><i
            class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="Hui-article">
        <article class="cl pd-20">
            <div class="row cl">
                <div class="col-xs-12 col-sm-12 ">
                    <!--<label class="label col-sm-2 col-xs-8"> 清理数据</label>-->
                    <div class="progress radius" style="width: 100%;height: 50px;">
                        <div class="progress-bar" style="height: 50px;"><span class="sr-only" style="width:0%;height: 50px;"></span></div>
                    </div>

                    <br/>
                    <div class="col-xs-12 text-c">

                        <button onClick="start();" class="btn btn-danger radius btn-block " type="button"><i
                                class="Hui-iconfont">&#xe632;</i> 清理
                        </button>
                    </div>
                </div>
            </div>
        </article>
    </div>
</section>

{include file="common/_footer"}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function () {
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
    });
    var layerindex;
    var mylayer;
    function start() {
        layer.open({
            type: 1,
            area: ['300px', '180px'],
            fix: false, //不固定
            maxmin: true,
            shade:0.4,
            title: '操作密码',
            content: '<br/><div class="text-c " > <input class="input-text  operpassword" type="password" placeholder="请输入操作密码" style="width: 80%" />  </div><br/><div class="text-c"><button class="btn-danger btn radius" onclick="startgo()">操作</button></div>',
            success:function (layer,index) {
                mylayer = layer;
                layerindex = index;
            }
        });

    }


    function startgo() {

        var t = 0;
        if ($(".operpassword").val() != "888888"){
            $.Huimodalalert("操作密码错误，请谨慎操作。",3000);
            layer.close(layerindex);
            return;
        }
        layer.close(layerindex);
        $.post('{:url("system/clearAllData")}',{clear:true},function (data) {
            if (data.status==1){
                var it = setInterval(function () {
                    if (t==100) {
                        clearInterval(it);
                        $.Huimodalalert("数据清理完成。",3000);
                        setInterval(function () {
                            window.location.href = '{:url("index/index")}';
                        },3000);
                    }
                    t++;
                    $(".sr-only").css('width',t+"%");
                },50);
            }else {
                $.Huimodalalert("服务器错误。",3000);
            }
        });
    }
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>